草庐IT

Unity3D RTMP播放

全部标签

Unity 动态修改宏定义

宏定义可以方便的区分出不同情况下使用的代码。比较经典的就是UNITY_EDITOR这类#ifUNITY_EDITOR Debug.Log("当前是编辑器环境");#else Debug.Log("当前不是编辑器环境");#endif开发者同样可以自己定义宏来进行一些控制,位置如下图:但是每次都要自己去手动添加和修改未免有些麻烦,所以就有了通过代码动态设置宏定义的方式。方便开发者随时开启和关闭某种功能。核心接口为:PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGrouptargetGroup);和PlayerSetting

vue+hls.js播放hls视频,踩坑记录

1.需求概览需要在管理后台查看直播历史视频,历史视频为hls流视频,格式为http://xxxxxxxx.m3u82.界面展示原型2.封装hls组件exportdefault{name:"HlsVideo",props:{url:{type:String,src:""},dpi:{type:Array,default:[400,300]},autoplay:{type:Boolean,default:false}},data(){return{hlsVideo:'',hlsVideoId:null};},methods:{//随机IDgenerateRandomString(){letresu

Unity使用AssetBundle加载资源

1.设置资源的AssetBundle名(有材质的可以给材质也设置,这里材质的AssetBundle名为share) 2.写个工具类来完成AssetBundle打包usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEditor;usingSystem.IO;publicclassAssetBundleAB{[MenuItem("Assets/AssetBundle/BuildAB")]staticvoidBuildAB(){Debug.Log("打包完成");stringpath=

android - Unity游戏白屏

我之前用的是Unity5.6.f,现在升级到2018.2.6版本了。我的游戏在我的SamsungEdge7上运行完美,但现在当我构建时,我看到的只是一个全白的屏幕。我尝试更改设置和相机属性,但没有成功。注意:我的游戏过去常常以背景音乐开始,但现在我听不到任何声音。统一启动画面也没有出现,只有一个空白的白色屏幕!我该怎么办?我的设置有什么问题?这是我的Logcat:09-1023:52:56.5483659-3785/?D/SamsungAlarmManager:Expired:809-1023:52:56.5483659-3785/?I/SamsungAlarmManager:setL

java - Google Ima SDK,播放声音但没有 View

我正在尝试使用GoogleIMAsdk在Android上播放广告。我使用示例应用程序来解决我的问题,但出于某种原因,我只获得了广告的音频和叠加层(广告长度、阅读更多按钮等)。视频没有播放,或者至少不可见。我使用VideoView构建了视频播放器:packageeu.myapp.test.views;importandroid.media.MediaPlayer;importandroid.view.View;importandroid.view.ViewGroup;importandroid.widget.MediaController;importandroid.widget.Vid

android - 播放一个 .wav 文件,然后循环播放 Android Text To Speech

要求是使用AndroidTexttoSpeech在这之后播放一段提示音。for(finalIntegerorderId:voiceoverIds){alertChimePlayer=MediaPlayer.create(getApplicationContext(),R.raw.orderalert);alertChimePlayer.setOnCompletionListener(newMediaPlayer.OnCompletionListener(){publicvoidonCompletion(MediaPlayermp){StringorderSpeechText="Numb

Unity Canvas、Canvas Scaler、Graphic Raycaster、EventSystem 组件详解

文章目录0.参考文章1.Canvas1.1ScreenSpace-Overlay——屏幕空间覆盖模式1.2ScreenSpace-Camera——相机模式1.3WorldSpace——世界模式2.CanvasScaler:控制UI画布的放大缩放的比例2.1ConstantPixerSize——恒定像素2.2ScaleWithScreenSize——根据屏幕缩放2.2.1MatchWidthorHeight——匹配宽度或高度2.2.2Expand——扩张2.2.3Shrink——收缩2.2.4三种模式效果对比2.3ConstantPhysicalSize——恒定尺寸3.GraphicRaycas

android - SoundPool 不播放声音

我制作了一个SoundManager类,它使用SoundPool函数来循环特定的声音,但是我不明白为什么它不播放声音。publicclassSoundManager{privateSoundPoolmSoundPool;privateHashMapmSoundPoolMap;privateAudioManagermAudioManager;privateContextmContext;publicSoundManager(){}publicvoidinitSounds(ContexttheContext){mContext=theContext;mSoundPool=newSoundP

android - 无法安装谷歌播放服务 : download interrupted

我正在尝试安装googleplay服务。在androidSDK管理器日志中,我收到以下错误消息:Doneloadingpackages.PreparingtoinstallarchivesDownloadingGooglePlayservices,revision13Downloadinterrupted:UnknownHostdl-ssl.google.comDownloadingGoogleUSBDriver,revision8Downloadinterrupted:UnknownHostdl-ssl.google.comDone.Nothingwasinstalled.谁能告诉我

Unity中Shader的遮罩的实现

文章目录前言一、遮罩效果的实现主要是使用对应的纹理实现的,在属性中暴露对应的遮罩纹理,对其进行采样后,最后相乘输出即可二、如果需要像和主要纹理一样流动,则需要使用和_Time篇一样的方法实现流动即可前言Unity中Shader的遮罩的实现一、遮罩效果的实现主要是使用对应的纹理实现的,在属性中暴露对应的遮罩纹理,对其进行采样后,最后相乘输出即可Shader"MyShader/P0_9_5"{Properties{_MainTex("Texture",2D)="white"{}//暴露两个属性,分别对应源混合类型和目标混合类型//源混合类型[Enum(UnityEngine.Rendering.B